package cn.cqu.edu.sb.HttpInterceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class MyConfigurer implements WebMvcConfigurer {
    @Resource
    private Interceptor interceptor;

    // 添加拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 设置拦截请求
        registry.addInterceptor(interceptor).addPathPatterns("/**").excludePathPatterns("/toPage/login");
    }
}
